package com.homwee.factory.pageData;

import java.util.ArrayList;
import java.util.List;

import android.util.Log;

import com.homwee.factory.FactoryActivity;
import com.homwee.factory.R;
import com.homwee.listMenu.util.MenuItemData;

public class PageData9 extends PageData{
	List<MenuItemData> mSubList_FuncPreset =new ArrayList<MenuItemData>();
	List<MenuItemData> list =new ArrayList<MenuItemData>();
	List<MenuItemData> pictureAdjustList =new ArrayList<MenuItemData>();
	List<String> mItemName;
	public MenuItemData energySetting;
	String onoffArray[];
	
	public final static byte STR_EANBLE = 0;
	public final static byte CI_EANBLE = 1;
	public final static byte DIVX_EANBLE = 2;
	public final static byte CHIQ_EANBLE = 3;
	public final static byte EUROPE_EANBLE = 4;
	public final static byte MEMC_EANBLE = 5;
	public final static byte PVR_EANBLE = 6;
	public final static byte PVR_ACTIVATED = 7;
	public final static byte GINNA = 8;
	public final static byte RESERVE_EANBLE = 9;
	
//	�ߣ�LMAX =150��low apl = 100�� cut pwm=150��low pwm=128��middle pwm=90��
//	�У�LMAX =100��low apl = 100�� cut pwm=128��low pwm=128��middle pwm=80��
//	�ͣ�LMAX =80��low apl = 100�� cut pwm=128��low pwm=128��middle pwm=60��
	int energyModeValue[][]={
			{150,100,150,128,90},
			{100,100,128,128,80},
			{80,100,128,128,60},
	};
	
	MenuItemData PresetLmax;
	MenuItemData PresetLowPointApl;
	MenuItemData PresetCutPointPwm;
	MenuItemData PresetLowPointPwm;
	MenuItemData PresetMidPointPwm;
	
	MenuItemData energyMode;
	MenuItemData energyGamma;
	MenuItemData pictureAdjust;
	
	public PageData9(FactoryActivity mFactoryActivity){
		super(mFactoryActivity);
		String [] itemNames =mFactoryActivity.getResources().getStringArray(R.array.factoryDynamicBacklightPresetParas);
		mItemName =new ArrayList<String>();
		for(String name:itemNames){
			mItemName.add(name);
		}
		onoffArray = mFactoryActivity.getResources().getStringArray(R.array.factoryOpenOrClose);
	}
	
	public List<MenuItemData> LoadPageData(){
		mListItemData.clear();
		mSubList_FuncPreset.clear();
		factorySetting.initPage9Data();

	    String energyModeStr = mFactoryActivity.getResources().getString(R.string.factory_energy_mode);
	    String energyGammaStr =mFactoryActivity.getResources().getString(R.string.factory_energy_gamma);
	    String energySettingStr =mFactoryActivity.getResources().getString(R.string.factory_energy_setting);
	    String pqOnOffStr = mFactoryActivity.getResources().getString(R.string.factory_pq_onoff);
		String energyEfficiencyStr = mFactoryActivity.getResources().getString(R.string.factory_energy_efficiency);
		
		String energyModeArray[]= mFactoryActivity.getResources().getStringArray(R.array.factoryEnergyMode);
		String energyGammaArray[]= mFactoryActivity.getResources().getStringArray(R.array.factoryEnergyGamma);
		
		energyMode =new MenuItemData(0,energyModeStr,0,energyModeArray.length -1,0,energyModeArray,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		energyMode.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				//factorySetting.setPQOnOff(value);
				if(value>0){
					value =value -1;
					PresetLmax.updateValue(energyModeValue[value][0]);
					PresetLowPointApl.updateValue(energyModeValue[value][1]);
					PresetCutPointPwm.updateValue(energyModeValue[value][2]);
					PresetLowPointPwm.updateValue(energyModeValue[value][3]);
					PresetMidPointPwm.updateValue(energyModeValue[value][4]);
					PresetLmax.valueChange();
					PresetLowPointApl.valueChange();
					PresetCutPointPwm.valueChange();
					PresetLowPointPwm.valueChange();
					PresetMidPointPwm.valueChange();
				}
			}
		});
		
		energyGamma =new MenuItemData(0,energyGammaStr,0,energyGammaArray.length -1,0,energyGammaArray,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		energyGamma.mInitValue =factorySetting.getGammaCompensateMode();
		energyGamma.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setGammaCompensateMode(mItemName.size() -1,value);
			}
		});
		
		MenuItemData pqOnOff =new MenuItemData(0,pqOnOffStr,0,onoffArray.length -1,0,onoffArray,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		pqOnOff.mInitValue =factorySetting.getPQOnOff();
		pqOnOff.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setPQOnOff(value);
			}
		});
		
		energySetting =new MenuItemData(energySettingStr);
		energySetting.setOnEnterKey(new MenuItemData.onEnterRightKey() {
			
			public void onEnterRightKey() {
				// TODO Auto-generated method stub
				//mFactoryActivity.showMenu(false);
				Log.v("tv","onEnterRightKey");
			}
		});	
		
		pictureAdjust =new MenuItemData("白平衡");
		pictureAdjust.setOnEnterKey(new MenuItemData.onEnterRightKey() {
			
			public void onEnterRightKey() {
				// TODO Auto-generated method stub
				Log.v("tv","onEnterRightKey");
			}
		});

//		MenuItemData energyEfficiency =new MenuItemData(energyEfficiencyStr);
//		energyEfficiency.setOnEnterKey(new MenuItemData.onEnterRightKey() {
//			
//			public void onEnterRightKey() {
//				// TODO Auto-generated method stub
//				//mFactoryActivity.showMenu(false);
//				Log.v("tv","onEnterRightKey");
//			}
//		});	
		
		
//		mListItemData.add(energyMode);
//		mListItemData.add(energyGamma);
		mListItemData.add(pqOnOff);
		mListItemData.add(energySetting);
//		mListItemData.add(pictureAdjust);
		if(factorySetting.isPDP()){//----->
			String []pdpGammaSelStr ={"8500~11000","11000~13500","= 8500","= 13500"};
			MenuItemData pdpGammaSel =new MenuItemData(0,"Gamma",0,pdpGammaSelStr.length -1,0,pdpGammaSelStr,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
			pdpGammaSel.mInitValue =factorySetting.getGammaIndex();
			pdpGammaSel.setOnValueChange(new MenuItemData.onValueChange() {
				
				@Override
				public void valueChange(int value) {
					// TODO Auto-generated method stub
					factorySetting.setGammaIndex(value);
				}
			});
			mListItemData.add(pdpGammaSel);	
		}else{
			String []otherGammaSelStr ={"10000~11500k","8500k~10000k","11500~13000k"};
			MenuItemData otherGammaSel =new MenuItemData(0,"Gamma",0,otherGammaSelStr.length -1,0,otherGammaSelStr,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
			otherGammaSel.mInitValue =factorySetting.getGammaIndex();
			otherGammaSel.setOnValueChange(new MenuItemData.onValueChange() {
				
				@Override
				public void valueChange(int value) {
					// TODO Auto-generated method stub
					factorySetting.setGammaIndex(value);
				}
			});
			mListItemData.add(otherGammaSel);	
		}
		
		//software function  preset
		MenuItemData SoftwareFuncPreset =new MenuItemData("Function Preset");
		
		MenuItemData mSTR =new MenuItemData(0,"STR Enable",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mSTR.mInitValue =factorySetting.getFunctionPresetByIndex(STR_EANBLE);
		mSTR.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","STR_EANBLE");
				factorySetting.setFunctionPresetByIndex(STR_EANBLE,value);
			}
		});	
		
		MenuItemData mCI =new MenuItemData(0,"CI Enable",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mCI.mInitValue =factorySetting.getFunctionPresetByIndex(CI_EANBLE);
		mCI.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","CI_EANBLE");
				factorySetting.setFunctionPresetByIndex(CI_EANBLE,value);
			}
		});	
		
		
		MenuItemData mDIVX =new MenuItemData(0,"Divx Enable",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mDIVX.mInitValue =factorySetting.getFunctionPresetByIndex(DIVX_EANBLE);
		mDIVX.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","DIVX_EANBLE");
				factorySetting.setFunctionPresetByIndex(DIVX_EANBLE,value);
			}
		});	
		
		MenuItemData mCHIQ =new MenuItemData(0,"CHIQ Enable",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mCHIQ.mInitValue =factorySetting.getFunctionPresetByIndex(CHIQ_EANBLE);
		mCHIQ.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","CHIQ_EANBLE");
				factorySetting.setFunctionPresetByIndex(CHIQ_EANBLE,value);
			}
		});	
		
		MenuItemData mEurope =new MenuItemData(0,"Europe Enable",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mEurope.mInitValue =factorySetting.getFunctionPresetByIndex(EUROPE_EANBLE);
		mEurope.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","EUROPE_EANBLE");
				factorySetting.setFunctionPresetByIndex(EUROPE_EANBLE,value);
			}
		});	
		
		MenuItemData mMEMC =new MenuItemData(0,"MEMC Enable",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mMEMC.mInitValue =factorySetting.getFunctionPresetByIndex(MEMC_EANBLE);
		mMEMC.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","MEMC_EANBLE");
				factorySetting.setFunctionPresetByIndex(MEMC_EANBLE,value);
			}
		});	
		
		MenuItemData mPVR =new MenuItemData(0,"PVR Enable",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mPVR.mInitValue =factorySetting.getFunctionPresetByIndex(PVR_EANBLE);
		mPVR.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","PVR_EANBLE");
				factorySetting.setFunctionPresetByIndex(PVR_EANBLE,value);
			}
		});	
		
		MenuItemData mPVR_ACTIVATED =new MenuItemData(0,"PVR Activated",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mPVR_ACTIVATED.mInitValue =factorySetting.getFunctionPresetByIndex(PVR_ACTIVATED);
		mPVR_ACTIVATED.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","PVR_ACTIVATED");
				factorySetting.setFunctionPresetByIndex(PVR_ACTIVATED,value);
			}
		});	
		
		MenuItemData mGinna =new MenuItemData(0,"Ginna",0,1,0,mFactoryActivity.getResources().getStringArray(R.array.factoryCloseOrOpen),1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		mGinna.mInitValue =factorySetting.getFunctionPresetByIndex(GINNA);
		mGinna.setOnValueChange(new MenuItemData.onValueChange() {
			
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				Log.v("tv","GINNA");
				factorySetting.setFunctionPresetByIndex(GINNA,value);
			}
		});
		
		
		mListItemData.add(SoftwareFuncPreset);
		
		mSubList_FuncPreset.add(mSTR);
		mSubList_FuncPreset.add(mCI);
		mSubList_FuncPreset.add(mDIVX);
		mSubList_FuncPreset.add(mCHIQ);
		mSubList_FuncPreset.add(mEurope);
		mSubList_FuncPreset.add(mMEMC);
		mSubList_FuncPreset.add(mPVR);
		mSubList_FuncPreset.add(mPVR_ACTIVATED);
		mSubList_FuncPreset.add(mGinna);
		
		mSTR.mParentGroup =mListItemData;
		mSTR.mParent = SoftwareFuncPreset;
		SoftwareFuncPreset.mSubChildGroup =mSubList_FuncPreset;
		
		

		loadNextPage(mListItemData,energySetting);
		loadPictureAdjustPage(mListItemData, pictureAdjust);
		return mListItemData;
	}
	private void loadNextPage(List<MenuItemData> parentGroup ,MenuItemData item){
		int index =0;
		list.clear();
		item.mPassword =false;
		final MenuItemData PresetProcPeroid =new MenuItemData(0,mItemName.get(index++),5,50,15,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetProcPeroid.mInitValue =factorySetting.getProcPeroid();
		PresetProcPeroid.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setProcPeroid(mItemName.indexOf(PresetProcPeroid.mName),value);
			}
		});
		
		final MenuItemData DarkEnhenceDownSpeed =new MenuItemData(0,mItemName.get(index++),1,100,8,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		DarkEnhenceDownSpeed.mInitValue =factorySetting.getDarkEnhenceDownSpeed();
		DarkEnhenceDownSpeed.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setDarkEnhenceDownSpeed(mItemName.indexOf(DarkEnhenceDownSpeed.mName),value);
			}
		});
		final MenuItemData PresetMidPointApl =new MenuItemData(0,mItemName.get(index++),100,210,140,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetMidPointApl.mInitValue =factorySetting.getPresetMidPointApl();
		PresetMidPointApl.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setPresetMidPointApl(mItemName.indexOf(PresetMidPointApl.mName),value);
			}
		});
		PresetMidPointPwm =new MenuItemData(0,mItemName.get(index++),50,120,80,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetMidPointPwm.mInitValue =factorySetting.getPresetMidPointPwm();
		PresetMidPointPwm.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setPresetMidPointPwm(mItemName.indexOf(PresetMidPointPwm.mName),value);
			}
		});
		
		
		PresetLmax =new MenuItemData(0,mItemName.get(index++),50,200,80,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetLmax.mInitValue =(factorySetting.getLmax());
		PresetLmax.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setLmax(mItemName.indexOf(PresetLmax.mName),value);
			}
		});
		final MenuItemData PresetLDarkSence =new MenuItemData(0,mItemName.get(index++),1,120,80,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetLDarkSence.mInitValue =factorySetting.getLDarkSence();
		PresetLDarkSence.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setLumaHistWeight(mItemName.indexOf(PresetLDarkSence.mName),value);
			}
		});
		final MenuItemData PresetSampleTimes =new MenuItemData(0,mItemName.get(index++),1,64,1,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetSampleTimes.mInitValue =factorySetting.getSampleTimes();
		PresetSampleTimes.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setSampleTimes(mItemName.indexOf(PresetSampleTimes.mName),value);
			}
		});
		final MenuItemData PresetCutPointApl =new MenuItemData(0,mItemName.get(index++),10,76,20,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetCutPointApl.mInitValue =factorySetting.getCutPointApl();
		
		PresetCutPointApl.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setCutPointApl(mItemName.indexOf(PresetCutPointApl.mName),value);
			}
		});
		PresetLowPointApl =new MenuItemData(0,mItemName.get(index++),50,128,100,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetLowPointApl.mInitValue =factorySetting.getLowPointApl();
		PresetLowPointApl.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setLowPointApl(mItemName.indexOf(PresetLowPointApl.mName),value);
			}
		});
		final MenuItemData PresetHighPointApl =new MenuItemData(0,mItemName.get(index++),210,250,250,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetHighPointApl.mInitValue =factorySetting.getHighPointApl();
		PresetHighPointApl.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setHighPointApl(mItemName.indexOf(PresetHighPointApl.mName),value);
			}
		});
		PresetCutPointPwm =new MenuItemData(0,mItemName.get(index++),100,150,128,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetCutPointPwm.mInitValue =factorySetting.getCutPointPwm();
		PresetCutPointPwm.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setCutPointPwm(mItemName.indexOf(PresetCutPointPwm.mName),value);
			}
		});
		PresetLowPointPwm =new MenuItemData(0,mItemName.get(index++),100,128,128,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetLowPointPwm.mInitValue =factorySetting.getLowPointPwm();
		PresetLowPointPwm.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setLowPointPwm(mItemName.indexOf(PresetLowPointPwm.mName),value);
			}
		});
		final MenuItemData PresetHighPointPwm =new MenuItemData(0,mItemName.get(index++),0,10,0,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetHighPointPwm.mInitValue =factorySetting.getHighPointPwm();
		PresetHighPointPwm.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setHighPointPwm(mItemName.indexOf(PresetHighPointPwm.mName),value);
			}
		});
		final MenuItemData PresetBigStepDiff =new MenuItemData(0,mItemName.get(index++),0,255,40,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetBigStepDiff.mInitValue =factorySetting.getBigStepDiff();
		PresetBigStepDiff.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setBigStepDiff(mItemName.indexOf(PresetBigStepDiff.mName),value);
			}
		});
		final MenuItemData PresetMidStepDiff =new MenuItemData(0,mItemName.get(index++),0,255,20,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetMidStepDiff.mInitValue =factorySetting.getMidStepDiff();
		PresetMidStepDiff.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setMidStepDiff(mItemName.indexOf(PresetMidStepDiff.mName),value);
			}
		});
		final MenuItemData PresetSmallStepDiff =new MenuItemData(0,mItemName.get(index++),0,255,10,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetSmallStepDiff.mInitValue =factorySetting.getSmallStepDiff();
		PresetSmallStepDiff.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setSmallStepDiff(mItemName.indexOf(PresetSmallStepDiff.mName),value);
			}
		});
		final MenuItemData PresetBigStepVal =new MenuItemData(0,mItemName.get(index++),1,100,2,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetBigStepVal.mInitValue =factorySetting.getBigStepVal();
		PresetBigStepVal.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setBigStepVal(mItemName.indexOf(PresetBigStepVal.mName),value);
			}
		});
		final MenuItemData PresetMidStepVal =new MenuItemData(0,mItemName.get(index++),1,100,2,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetMidStepVal.mInitValue =factorySetting.getMidStepVal();
		PresetMidStepVal.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setMidStepVal(mItemName.indexOf(PresetMidStepVal.mName),value);
			}
		});
		final MenuItemData PresetSmallStepVal =new MenuItemData(0,mItemName.get(index++),1,100,1,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		PresetSmallStepVal.mInitValue =factorySetting.getSmallStepVal();
		PresetSmallStepVal.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setSmallStepVal(mItemName.indexOf(PresetSmallStepVal.mName),value);
			}
		});
		
		final MenuItemData DCCEnable  =new MenuItemData(0,mItemName.get(index++),0,1,0,onoffArray,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		DCCEnable.mInitValue =(factorySetting.getDCCEnable()+1)%2;
		DCCEnable.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setDCCEnable(mItemName.indexOf(DCCEnable.mName),(value+1)%2);
			}
		});
		
		final MenuItemData DCCZeroPonit =new MenuItemData(0,mItemName.get(index++),50,100,75,1, MenuItemData.EN_ItemType.EN_OPTIONVIEW);
		DCCZeroPonit.mInitValue =factorySetting.getDCCZeroPonit();
		DCCZeroPonit.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setDCCZeroPonit(mItemName.indexOf(DCCZeroPonit.mName),value);
			}
		});
		
//		final MenuItemData PresetGammaCompensateMode =new MenuItemData(0,mItemName.get(index++),0,5,3,1,EN_ItemType.EN_OPTIONVIEW);
//		PresetGammaCompensateMode.mInitValue =factorySetting.getGammaCompensateMode();
//		PresetGammaCompensateMode.setOnValueChange(new MenuItemData.onValueChange() {
//			
//			@Override
//			public void valueChange(int value) {
//				// TODO Auto-generated method stub
//				factorySetting.setGammaCompensateMode(mItemName.indexOf(PresetGammaCompensateMode.mName),value);
//			}
//		});
		  
		
		
		list.add(energyMode);
		list.add(energyGamma);
		
		list.add(PresetProcPeroid);
		//list.add(DarkEnhenceDownSpeed);
		//list.add(PresetMidPointApl);
		//list.add(PresetMidPointPwm);
		list.add(PresetLmax);
		list.add(PresetLDarkSence);
		list.add(DarkEnhenceDownSpeed);
		list.add(PresetSampleTimes);
		list.add(PresetCutPointApl);
		list.add(PresetLowPointApl);
		list.add(PresetMidPointApl);
		list.add(PresetHighPointApl);
		list.add(PresetCutPointPwm);
		list.add(PresetLowPointPwm);
		list.add(PresetMidPointPwm);
		list.add(PresetHighPointPwm);
		list.add(PresetBigStepDiff);
		list.add(PresetMidStepDiff);
		list.add(PresetSmallStepDiff);
		list.add(PresetBigStepVal);
		list.add(PresetMidStepVal);
		list.add(PresetSmallStepVal);
		list.add(DCCEnable);
		list.add(DCCZeroPonit);
		//list.add(PresetGammaCompensateMode);
		list.get(0).mParentGroup =parentGroup;
		list.get(0).mParent =item;
		item.mSubChildGroup =list;
	}
	
	private void loadPictureAdjustPage(List<MenuItemData> parentGroup ,MenuItemData item){
		pictureAdjustList.clear();
		final MenuItemData r  =new MenuItemData(0,"R",0,100,factorySetting.getRedGain(),1, MenuItemData.EN_ItemType.EN_PROGRESSBAR);
		r.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setRedGain(value);
			}
		});
		final MenuItemData rOffset  =new MenuItemData(0,"R-Offset",0,100,factorySetting.getRedOffset(),1, MenuItemData.EN_ItemType.EN_PROGRESSBAR);
		rOffset.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setRedOffset(value);
			}
		});
		final MenuItemData g  =new MenuItemData(0,"G",0,100,factorySetting.getGreenGain(),1, MenuItemData.EN_ItemType.EN_PROGRESSBAR);
		g.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setGreenGain(value);
			}
		});
		final MenuItemData gOffset  =new MenuItemData(0,"G-Offset",0,100,factorySetting.getGreenOffset(),1, MenuItemData.EN_ItemType.EN_PROGRESSBAR);
		gOffset.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setGreenOffset(value);
			}
		});
		final MenuItemData b  =new MenuItemData(0,"B",0,100,factorySetting.getBlueGain(),1, MenuItemData.EN_ItemType.EN_PROGRESSBAR);
		b.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setBlueGain(value);
			}
		});
		final MenuItemData bOffset  =new MenuItemData(0,"B-Offset",0,100,factorySetting.getBlueOffset(),1, MenuItemData.EN_ItemType.EN_PROGRESSBAR);
		bOffset.setOnValueChange(new MenuItemData.onValueChange() {
			
			@Override
			public void valueChange(int value) {
				// TODO Auto-generated method stub
				factorySetting.setBlueOffset(value);
			}
		});
		pictureAdjustList.add(r);
		pictureAdjustList.add(rOffset);
		pictureAdjustList.add(g);
		pictureAdjustList.add(gOffset);
		pictureAdjustList.add(b);
		pictureAdjustList.add(bOffset);
		pictureAdjustList.get(0).mParentGroup =parentGroup;
		pictureAdjustList.get(0).mParent =item;
		item.mSubChildGroup =pictureAdjustList;
		
	}

	public List<MenuItemData> getNextPageList() {
		// TODO Auto-generated method stub
		return list;
	}
}
